import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router'
Vue.use(VueRouter);
//1.创建组件
import Index from '@/views/index'
import Home from '@/views/home'
import Login from '@/views/login'
import NotFound from '@/views/404'
import UpdatePassword from '@/views/update-password'
import pay from '@/views/pay'
import register from '@/views/register'
import center from '@/views/center'
    import youketongji from '@/views/modules/youketongji/list'
    import news from '@/views/modules/news/list'
    import sheshifenlei from '@/views/modules/sheshifenlei/list'
    import xiangmufenlei from '@/views/modules/xiangmufenlei/list'
    import youke from '@/views/modules/youke/list'
    import gongyuansheshi from '@/views/modules/gongyuansheshi/list'
    import changdixinxi from '@/views/modules/changdixinxi/list'
    import discussyouwanxiangmu from '@/views/modules/discussyouwanxiangmu/list'
    import menu from '@/views/modules/menu/list'
    import storeup from '@/views/modules/storeup/list'
    import sheshiweihu from '@/views/modules/sheshiweihu/list'
    import changdileixing from '@/views/modules/changdileixing/list'
    import discussgongyuansheshi from '@/views/modules/discussgongyuansheshi/list'
    import youwanxiangmu from '@/views/modules/youwanxiangmu/list'
    import youwanyuyue from '@/views/modules/youwanyuyue/list'
    import config from '@/views/modules/config/list'
    import changdiyuyue from '@/views/modules/changdiyuyue/list'


//2.配置路由   注意：名字
const routes = [{
    path: '/index',
    name: '系统首页',
    component: Index,
    children: [{
      // 这里不设置值，是把main作为默认页面
      path: '/',
      name: '系统首页',
      component: Home,
      meta: {icon:'', title:'center'}
    }, {
      path: '/updatePassword',
      name: '修改密码',
      component: UpdatePassword,
      meta: {icon:'', title:'updatePassword'}
    }, {
      path: '/pay',
      name: '支付',
      component: pay,
      meta: {icon:'', title:'pay'}
    }, {
      path: '/center',
      name: '个人信息',
      component: center,
      meta: {icon:'', title:'center'}
    }
      ,{
	path: '/youketongji',
        name: '游客统计',
        component: youketongji
      }
      ,{
	path: '/news',
        name: '公告信息',
        component: news
      }
      ,{
	path: '/sheshifenlei',
        name: '设施分类',
        component: sheshifenlei
      }
      ,{
	path: '/xiangmufenlei',
        name: '项目分类',
        component: xiangmufenlei
      }
      ,{
	path: '/youke',
        name: '游客',
        component: youke
      }
      ,{
	path: '/gongyuansheshi',
        name: '公园设施',
        component: gongyuansheshi
      }
      ,{
	path: '/changdixinxi',
        name: '场地信息',
        component: changdixinxi
      }
      ,{
	path: '/discussyouwanxiangmu',
        name: '游玩项目评论',
        component: discussyouwanxiangmu
      }
      ,{
	path: '/menu',
        name: '菜单列表',
        component: menu
      }
      ,{
	path: '/storeup',
        name: '我的收藏管理',
        component: storeup
      }
      ,{
	path: '/sheshiweihu',
        name: '设施维护',
        component: sheshiweihu
      }
      ,{
	path: '/changdileixing',
        name: '场地类型',
        component: changdileixing
      }
      ,{
	path: '/discussgongyuansheshi',
        name: '公园设施评论',
        component: discussgongyuansheshi
      }
      ,{
	path: '/youwanxiangmu',
        name: '游玩项目',
        component: youwanxiangmu
      }
      ,{
	path: '/youwanyuyue',
        name: '游玩预约',
        component: youwanyuyue
      }
      ,{
	path: '/config',
        name: '轮播图管理',
        component: config
      }
      ,{
	path: '/changdiyuyue',
        name: '场地预约',
        component: changdiyuyue
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {icon:'', title:'login'}
  },
  {
    path: '/register',
    name: 'register',
    component: register,
    meta: {icon:'', title:'register'}
  },
  {
    path: '/',
    name: '系统首页',
    redirect: '/index'
  }, /*默认跳转路由*/
  {
    path: '*',
    component: NotFound
  }
]
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
  mode: 'hash',
  /*hash模式改为history*/
  routes // （缩写）相当于 routes: routes
})
const originalPush = VueRouter.prototype.push
//修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}
export default router;
